﻿using Microsoft.Extensions.Logging;
using YiMeiJiaApp.Data;
using YiMeiJiaService.Service;
using YiMeiJiaService.IService;
using YiMeiJiaService.Assembly.DB;

namespace YiMeiJiaApp
{
    public static class MauiProgram
    {
        public static MauiApp CreateMauiApp()
        {
            var builder = MauiApp.CreateBuilder();
            builder
                .UseMauiApp<App>()
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                });

            builder.Services.AddMauiBlazorWebView();

#if DEBUG
            builder.Services.AddBlazorWebViewDeveloperTools();
            builder.Logging.AddDebug();
#endif
            // 全局异常拦截



            // 注册sqlite 数据库
            //builder.Services.AddSingleton<YMJLifeSqlite>();

            //builder.Services.AddSingleton<WeatherForecastService>();
            // 依赖注入
            builder.Services.AddTransient<IAcccount, YiMeiJiaService.Service.Account>();
            builder.Services.AddTransient<IGoods, YiMeiJiaService.Service.Goods>();
            return builder.Build();
        }
    }
}